<?php
/**
 * Created by PhpStorm.
 * User: ouryun
 * Date: 2021/5/12
 * Time: 11:35
 */

namespace app\api\model;


use think\Model;

class DistributorModel extends Model
{
    /**
     * 设备表
     * @var string
     */
    protected $table = 'lg_equip';

    /**
     * 获取门店id
     * @param $device_id
     * @param $channel_id
     * @return mixed
     */
    public function getShopIdByEquipInfo($device_id, $channel_id)
    {
        return self::where(['equip_id' => $device_id, 'channel_id' => $channel_id])->value('shop_id', 0);
    }

    /**
     * 获取店铺id
     * @param $deviceId
     * @return array
     */
    public function getShopId($deviceId)
    {
        return self::whereIn('equip_id', $deviceId)->column('equip_id', 'shop_id');
    }

    /**
     * 获取进出
     * @param $deviceId
     * @param $channelId
     * @return mixed
     */
    public function isCome($deviceId, $channelId)
    {
        return self::where(['equip_id' => $deviceId, 'channel_id' => $channelId])->value('is_come', 0);
    }
}